﻿using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;

public class GameManager : MonoBehaviour
{

	private InterstitialAd ad;
	// Use this for initialization
	void Start()
	{
		string adUnitId = "ca-app-pub-1914745923073729/2411264630";//ca-app-pub-1528318812740485/7686981059
		ad = new InterstitialAd(adUnitId);
		AdRequest request = new AdRequest.Builder().Build();
		ad.LoadAd(request);
	}

	// Update is called once per frame
	void Update()
	{

	}

	public void OnPlayButtonClick()
	{
		Application.LoadLevel(1);
	}

	public void OnPauseButtonClick()
	{
		//暂停游戏
		//展示广告
		ShowInterstitialAd();
	}

	public void ShowInterstitialAd()
	{

		if (ad.IsLoaded())
		{
			ad.Show();
		}
	}
}
